package com.homework.demo3;

import java.util.Comparator;

public class TeacherComparator implements Comparator<Teacher> {
    @Override
    public int compare(Teacher o1, Teacher o2) {
        if (o1.getAge()!=o2.getAge()){
            return o1.getAge()- o2.getAge();
        }else {
            return Double.compare(o1.getSalary(),o2.getSalary());
        }

    }
}
